<?php
	if(isset($_REQUEST['logar']))
	$logar = $_REQUEST['logar'];
	else 
	$logar = "";
	if($logar == "adm")require("../library/ssr/logaadm.php"); else require("../library/ssr/loga_ssr.php");
		
?>
<?php
	require("../library/ssr/coneccao.php");
	require("../library/ssr/icone.php");
?>
<title>Lista Completa de Marcadores Moleculares SSR</title>

<meta http-equiv=Content-Type content="text/html; charset=UTF-8">
<p align="center">

<style type="text/css">
	<!--
	.style1 {font-size: 26px}
	-->
</style>

<style type="text/css">
	<!--
	.style2 {
		color: #FFFFFF;
		font-weight: bold;
	}
	.style3 {color: #0000FF}
	-->
</style>

<span class="style1">Lista completa de SSR </span><br><br>

<table width="1200" border="1" bordercolor="#000000" cellspacing="0">
	
	<tr bgcolor="#000000">
		<td NOWRAP width="50"height="20" title="Mostra o Id de Cada Marcador" colspan="3"><font color="#FFFFFF" ><strong>Ac&otilde;es</strong></font></td>

		<td width="50" height="20" title="Marcador SSR"><font color="#FFFFFF"><strong>SSR</strong></font></td>
		<td width="50" height="20" title="Numero do Est"><font color="#FFFFFF"><strong>EST</strong></font></td>
		<td width="100"  height="20" title="Tipo do Marcador"><font color="#FFFFFF"><strong>Tipo</strong></font></td>
		<td width="50" height="20" title="Repeat"><font color="#FFFFFF"><strong>Repeat</strong></font></td>
		<td width="150" height="20" title="Arquivo"><font color="#FFFFFF"><strong>Arquivo</strong></font></td>
		<td width="300" height="20" title="Primer R"><font color="#FFFFFF"><strong>Primer R 5'--> 3'</strong></font></td>
		<td width="300" height="20" title="Primer F"><font color="#FFFFFF"><strong>Primer F 5'--> 3'</strong></font></td>		
		<td width="75" height="20" title="Tm."><font color="#FFFFFF"><strong>TM</strong></font></td>
		<td width="75" height="20" title="Mostra se &eacute; Polim&oacute;rfico"><font color="#FFFFFF"><strong>Polimorfico</strong></font></td>
		<td width="40" height="20" title="N&uacute;mero de Alelos"><font color="#FFFFFF"><strong>Alelos</strong></font></td>
	</tr>
	<?php	
function mostra_dados($inicio, $fim, $total_linhas, $cont, $is_logged, $vector){
	?><tr bgcolor="<?if(($cont % 2)== 0) echo "#CCCCCC"; else echo "#FFFFFF"?>"><?	
	?><td width="200" height="20"><a title="Editar Dados" href="../ssr/editar.php?acao=editar&inicio=<?echo $inicio?>&fim=<?echo $fim?>&logar=<?echo $is_logged?>&meuId=<?echo $vector['id']?>">Editar marcador</a></td>
	<td width="230" height="20"><a title="Deletar Dados" href="../ssr/deletar.php?acao=deletar&inicio=<?echo $inicio?>&fim=<?echo $fim?>&logar=<?echo $is_logged?>&meuId=<?echo $vector['id']?>">Deletar marcador</a></td>
	<td width="185" height="20"><a title="Inserir an&aacute;lise" href="../ssr/novo_registro.php?logar=<?echo $logar?>&meuId=<?echo $vector['id']?>&inicio=<?echo $inicio?>&fim=<?echo $fim?>">Inserir an&aacute;lise</a></td>
	<?php
		if($vector["marcador"] != "")
	echo strtoupper("	
		<td> $vector->marcador</td>
		<td> $vector->nome_do_est</td>
		<td> $vector->tipo</td>
		<td> $vector->repeat_ssr</td>
		<td> $vector->arquivo</td>
		<td> $vector->primer_r</td>
		<td> $vector->primer_f</td>	
		<td> $vector->tm</td>
		<td> $vector->polimorfico</td>
		<td> $vector->n_de_alelos</td>
		\n");
	?> </tr><?php
}
$total_linhas = null;
if(isset($_REQUEST['acao']))
	$acao = $_REQUEST['acao'];
else 
	$acao = "";
if($acao == "mostrar"){
$exec=mysql_query("SELECT * FROM ssr ORDER BY id ASC")or die(mysql_error());
$total=mysql_num_rows($exec);
$total_linhas = $total;
$aux = 0;	
if(isset($_REQUEST['inicio']))
$inicio = $_REQUEST['inicio'];
else 
$inicio = "";	

if(isset($_REQUEST['fim']))
$fim = $_REQUEST['fim'];
else 
$fim = "";	
$ssr = $this->funcoes->listar();
    foreach ($ssr as $ssrAtual):    	
	if(($aux >= $inicio) && ($aux < $fim))
		mostra_dados($inicio, $fim, $total, $aux, $logar, $ssrAtual);
	$aux++;	
endforeach;



	?>

</table>

<?php

$qtd_paginas = 20;
$cont = 1;

	?><table><tr><td><a title="Proximo" href="../ssr/lista_completa_ssr.php?acao=mostrar&logar=<?echo $logar?>&inicio=0&fim=<?echo$qtd_paginas?>">Primeira P&aacute;gina</a><td><?
$inicio_ultima_pagina = null;
for($i =0; $i <= $total_linhas; $i++){
	
	if(($i%$qtd_paginas) == 0){	
		if($i != $total_linhas){?><td><a title="Proximo" href="../ssr/lista_completa_ssr.php?acao=mostrar&logar=<?echo $logar?>&inicio=<?echo $i?>&fim=<?echo $i + $qtd_paginas?>"><?echo $cont?></a><td><?}
	$inicio_ultima_pagina = $i;
	$cont++;
	}
}


	?><td><a title="Anterior" href="../ssr/lista_completa_ssr.php?acao=mostrar&logar=<?echo $logar?>&inicio=<?echo $inicio_ultima_pagina?>&fim=<?echo $total_linhas?>">&Uacute;ltima P&aacute;gina</a></td><?
	
	
	?></tr></table><?php
}	
?>
<table>
<tr><td align="center"><a title="Menu do usu&aacute;rio" href="../ssr/<?if($logar == "adm")echo "administrador.php";else echo "usuario.php";?>"><?if($logar == "adm")echo " Menu do Administrador";else echo "Menu do Usu&aacute;rio"?></a></td></tr>

</table>
